//
//  TicketOrderCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/12/22.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "TicketOrderCell.h"

@interface TicketOrderCell ()

@property (weak, nonatomic) IBOutlet UILabel *orderCodeLabel;

@property (weak, nonatomic) IBOutlet UILabel *statueLabel;

@property (weak, nonatomic) IBOutlet UIImageView *ticketImageView;

@property (weak, nonatomic) IBOutlet UILabel *ticketNameLabel;

@property (weak, nonatomic) IBOutlet UILabel *ticketNumLabel;

@property (weak, nonatomic) IBOutlet UILabel *dateLabel;

@property (weak, nonatomic) IBOutlet UILabel *sumLabel;

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;

@end

@implementation TicketOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
//支付状态:2创建，0提交支付，1成功，-1失败
- (void)setModel:(OrderModel *)model {
    
    _model = model;
    self.sumLabel.text = MYLocalizedString(@"TICKET_ORDER_SUM", nil);
    self.orderCodeLabel.text = [NSString stringWithFormat:@"%@:%@",MYLocalizedString(@"MYORDER_ORDERNO", nil),model.ordernumber];
    [self.ticketImageView setImageURL:[NSURL URLWithString:model.picture] placeholderImage:kPlaceholderSqu];
    self.ticketNameLabel.text = model.subject;
    self.ticketNumLabel.text = [NSString stringWithFormat:@"x%@",model.size];
    self.dateLabel.text = [[NSDate dateWithTimeIntervalSince1970:model.ordertime.doubleValue / 1000] stringWithFormat:@"yyyy-MM-dd HH:mm"];;
    self.priceLabel.text = model.realpay;
    
    
//    支付状态:2创建，0提交支付，1成功，-1失败，11待确认/12已确认/13已取消/14等待审核/15审核通过
    
    switch (model.orderstatus.integerValue) {
        case 16:
         {
            
             self.statueLabel.text = MYLocalizedString(@"TICKET_ERROR_TITLE", nil);
        }
            break;
            
        case 0:
        case -1:
        case 2: {
            
            self.statueLabel.text = MYLocalizedString(@"TICKET_PAY_RETRY", nil);
        }
            break;
        case 15: {
            
            self.statueLabel.text = MYLocalizedString(@"TICKET_USSUING", nil);
        }
            break;
        case 17: {
            self.statueLabel.text = MYLocalizedString(@"TICKET_SUCCESS_TITLE", nil);
        }
            break;
        case 3: {
            self.statueLabel.text = MYLocalizedString(@"TICKET_ORDER_OFF", nil);
        }
            break;
        default:
            break;
    }
}

@end
